<?
require 'global.php';

$pid=0; if (isset($_GET["pid"])) $pid = clean($_GET["pid"]);
$color_oid=0; if (isset($_GET["color_oid"])) $color_oid = clean($_GET["color_oid"]);
$size_oid=0; if (isset($_GET["size_oid"])) $size_oid = clean($_GET["size_oid"]);
$other1_oid=0; if (isset($_GET["other1_oid"])) $other1_oid = clean($_GET["other1_oid"]);
$other2_oid=0; if (isset($_GET["other2_oid"])) $other2_oid = clean($_GET["other2_oid"]);

$do=''; if (isset($_GET["do"])) $do = clean($_GET["do"]);

//echo $pid.'/'.$varid.'/'.$qty.'/'.$do;
//exit;
$k=0;
if($do=='get_id'){

	$where=array();
	$where[]=array('name'=>'product_id','val'=>$pid);
	$where[]=array('name'=>'color','val'=>$color_oid);
	$where[]=array('name'=>'size','val'=>$size_oid);
	$where[]=array('name'=>'other1','val'=>$other1_oid);
	$where[]=array('name'=>'other2','val'=>$other2_oid);
	$res=$product_variation->get_rows_advanced(1,$where);
	if(!empty($res)) {
		$k=$res[0]['id'];
	}
}

echo $k;

?>